<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>props</title>

</head>
<body>
<div id="test"></div>
</body>
<script src="../js/react.development.js"></script>
<script src="../js/react-dom.development.js"></script>
<!--将jsx转为js-->
<script src="../js/babel.min.js"></script>
<!--babel  由babel转换jsx-->
<script type="text/babel">
    //1.创建类式组件
    class Person extends React.Component {
        render() {
            const {name, age, sex} = this.props
            return (
                <ul>
                    <li>姓名：{name}</li>
                    <li>性别：{parseInt(age) + 1}</li>
                    <li>年龄:{sex}</li>
                </ul>
            )
        }
    }

    //2.渲染组件到页面
    const p = {
        name: '老刘',
        age: 18,
        sex: '女'
    }
    // ReactDOM.render(<Person name={p.name} age={p.age} sex={p.sex} />, document.getElementById('test'))
    ReactDOM.render(<Person {...p}/>, document.getElementById('test'))
</script>
</html>